home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-12-28 | 2.9 KB | 108 lines | [TEXT/MPS ] |
- (*******************************************************************
-
- Transfer List.p
-
- LDEF for dynamic Transfer menu demo.
-
- (c) 1988, by Clifford Story & Attic Software
-
- *******************************************************************)
-
- unit Transferlist;
-
- (******************************************************************)
-
- interface
-
- (******************************************************************)
-
- uses memtypes, quickdraw, osintf, toolintf, packintf, Common;
-
- (******************************************************************)
-
- procedure listdef(message : integer; select : logical;
- therect : Rect; thecell : Cell; dataoffset : integer;
- datalen : integer; thelist : ListHandle);
-
- (******************************************************************)
-
- implementation
-
- (******************************************************************)
-
- {$R-}
- {$SC+}
-
- (******************************************************************)
-
- procedure drawcell(thelist : ListHandle; therect : Rect;
- thecell: Cell; select : logical); forward;
-
- (*******************************************************************
-
- listdef
- -------
-
- An LDEF is called to do four different things: initialize any
- provate data structures; draw an element of the list; highlight
- an element of the list; and dispose of any private data. The
- “message” parameter determines which service is requested.
-
- I have never known an LDEF that used private data, and
- highlighting is usually done by simply inverting the element's
- rectangle, so about all an LDEF has to do is draw.
-
- *******************************************************************)
-
- procedure listdef(message : integer; select : logical;
- therect : Rect; thecell : Cell; dataoffset : integer;
- datalen : integer; thelist : ListHandle);
-
- begin
-
- case message of
- lInitMsg : ;
- lDrawMsg : drawcell(thelist, therect, thecell, select);
- lHiliteMsg : InvertRect(therect);
- lCloseMsg : ;
- end;
-
- end;
-
- (*******************************************************************
-
- drawcell
- --------
-
- This routine draws one element in the list. It's a good example
- of why you should always write your own LDEF instead of using
- the standard LDEF 0. LDEF's are very easy to write, and you can
- shape yours to fit the data. LDEF 0, on the other hand, has to
- be very general, and has to be spoon-fed the data.
-
- *******************************************************************)
-
- procedure drawcell(thelist : ListHandle; therect : Rect;
- thecell : Cell; select : logical);
-
- var
- thehandle : thandle;
-
- begin
-
- thehandle := thandle(GetResource('TRNS', 1001));
-
- MoveTo(therect.left + 4, therect.bottom - 4);
- DrawString(thehandle^^.appl[thecell.v + 1].name);
-
- if select then
- InvertRect(therect);
-
- end;
-
- (******************************************************************)
-
- end.
-
- (******************************************************************)
-